﻿@model List<ScrumPilot.Domain.Models.SprintForTable>
@{
    ViewBag.Title = "Sprints Definition";
    Boolean isAdmin = ScrumPilot.Helpers.SPHelpers.IsAdmin(int.Parse(this.User.Identity.Name));
}
@section HeadContent{
    <link href="@Url.Content("~/Content/jquery.toChecklist.min.css")" rel="stylesheet" type="text/css" />
}
@section AddJavaScript
{
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery.toChecklist.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/SprintDef.js")'></script>
    <script type="text/javascript">
        var myPage = new SprintDef();
    </script>
}
@section JSDocumentReady
{
myPage.Ready();
}
@section PageOptionUrl
{
    '@Url.Action("_UpdateSprintDef", "Sprint")',
    '@Url.Action("_SprintFollowedProject", "Sprint")',
    '@Url.Action("SetIterations", "Sprint")' 
}
<div id="mainstdcontent">
    <h2>
        Sprints Definition</h2>
    <a id="NewButton" onclick="return myPage.OpenUpdSprint(-1)">New sprint</a>
    <table id="stdtable" style="width: 100%">
        <tr>
            <th>
                Name
            </th>
            <th>
                StartDate
            </th>
            <th>
                EndDate
            </th>
            <th>
                State
            </th>
            <th>
                IterationCount
            </th>
            <th>
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.StartDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.EndDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.State)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Iterations)
                </td>
                <td>
                    <a class="CheckButton" data-id="@item.ID">Set projects</a> <a class="EditButton" data-id="@item.ID">
                        Edit</a> <a class="DeleteButton" data-id="@item.ID">Delete</a>
                </td>
            </tr>
        }
    </table>
</div>
@if (isAdmin)
{
    <div id="dialog-sprint" title="Create/Modify Sprint Definition" style="display: none">
    </div>
}